/*
 * =====================================================================================
 *
 *       Filename:  light.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  02/16/2011 10:01:16 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  dp (8023), dp8023@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */

#ifndef _LIGHT_H_
#define _LIGHT_H_

#include <iostream>

using namespace std;

class light
{
	public:
		light(){}
		~light(){}

		void turnon();
		void turnoff();
};

class command
{
	public:
		command(){}
		virtual ~command(){}

		virtual void execute() = 0;
		virtual void unexecute() = 0;
};

class lightcommand:public command
{
	public:
		lightcommand(light *plight):m_light(plight){}
		virtual ~lightcommand()
		{
			if (m_light)
			{
				delete m_light;
				m_light = NULL;
			}
		}

		void execute();
		void unexecute();

	private:
		light *m_light;
};

class change
{
	public:
		change(lightcommand *p_lc):m_lc(p_lc){}
		virtual ~change(){}

		void open();
		void close();

	private:
		lightcommand *m_lc;
};

#endif

